package com.ruoyi.screeningDate.controller;

import com.ruoyi.award.domain.FirefighterAward;
import com.ruoyi.award.service.IFirefighterAwardService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.drill.domain.FirefighterDrill;
import com.ruoyi.drill.service.IFirefighterDrillService;
import com.ruoyi.emergency.domain.FirefighterEmergency;
import com.ruoyi.emergency.service.IFirefighterEmergencyService;
import com.ruoyi.firefighter.domain.FirefighterInfo;
import com.ruoyi.firefighter.domain.NameAndAge;
import com.ruoyi.firefighter.service.IFirefighterInfoService;
import com.ruoyi.graduation.domain.GraduationSchool;
import com.ruoyi.graduation.service.IGraduationSchoolService;
import com.ruoyi.ifmDepartmentTitle.domain.IfmDepartmentTitle;
import com.ruoyi.ifmDepartmentTitle.service.IIfmDepartmentTitleService;
import com.ruoyi.qualification.domain.FirefighterQualification;
import com.ruoyi.qualification.service.IFirefighterQualificationService;
import com.ruoyi.record.domain.FirefighterRecord;
import com.ruoyi.record.service.IFirefighterRecordService;
import com.ruoyi.screeningDate.addomain.AddVo;
import com.ruoyi.screeningDate.addomain.AwardUpdate;
import com.ruoyi.screeningDate.addomain.AwardUpdate1;
import com.ruoyi.screeningDate.addomain.FirefighterAwardVo;
import com.ruoyi.security.domain.FirefighterSecurity;
import com.ruoyi.security.service.IFirefighterSecurityService;
import com.ruoyi.task.domain.FirefighterFireTask;
import com.ruoyi.task.service.IFirefighterFireTaskService;
import com.ruoyi.tournament.domain.FirefighterTournament;
import com.ruoyi.tournament.service.IFirefighterTournamentService;
import com.ruoyi.train.domain.FirefighterTrain;
import com.ruoyi.train.service.IFirefighterTrainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import static com.ruoyi.common.core.domain.AjaxResult.success;
import static com.ruoyi.common.utils.PageUtils.startPage;

@Anonymous
@RestController
@RequestMapping("/add/add")
public class batchAddController {
    @Autowired
    private IFirefighterAwardService firefighterAwardService;
    @Autowired
    private IIfmDepartmentTitleService ifmDepartmentTitleService;
    @Autowired
    private IFirefighterTournamentService firefighterTournamentService;
    @Autowired
    private IFirefighterDrillService firefighterDrillService;
    @Autowired
    private IFirefighterFireTaskService firefighterFireTaskService;
    @Autowired
    private IFirefighterTrainService firefighterTrainService;
    @Autowired
    private IFirefighterEmergencyService firefighterEmergencyService;
    @Autowired
    private IFirefighterSecurityService firefighterSecurityService;
    @Autowired
    private IFirefighterRecordService firefighterRecordService;
    @Autowired
    private IFirefighterInfoService firefighterInfoService;
    @Autowired
    private IFirefighterQualificationService firefighterQualificationService;
    @Autowired
    private IGraduationSchoolService graduationSchoolService;

    /**
     * 奖励批量修改
     * @param awardUpdate
     */
    @PutMapping("/update")
    public AjaxResult update(@RequestBody AwardUpdate awardUpdate) {
        FirefighterAward firefighterAward = new FirefighterAward();
        firefighterAward.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterAward.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterAward.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterAward.setLevles(award.getLevles());
            firefighterAward.setTime(award.getTime());
            firefighterAward.setAwrad(award.getName());
            if (firefighterAwardService.updateFirefighterAward(firefighterAward) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }

    /**
     * 比武竞赛批量修改
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update1")
    public AjaxResult update1(@RequestBody AwardUpdate awardUpdate) {
        FirefighterTournament firefighterTournament = new FirefighterTournament();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setLevles(award.getLevles());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setTournament(award.getName());
            firefighterTournament.setRank(award.getRank());
            firefighterTournament.setSubject(award.getSubject());
            if (firefighterTournamentService.updateFirefighterTournament(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }

    /**
     * 重大演习演练批量修改
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update2")
    public AjaxResult update2(@RequestBody AwardUpdate awardUpdate) {
        FirefighterDrill firefighterTournament = new FirefighterDrill();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setLevles(award.getLevles());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setDrill(award.getName());
            if (firefighterDrillService.updateFirefighterDrill(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }

    /**
     * 重大火灾任务批量修改
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update3")
    public AjaxResult update3(@RequestBody AwardUpdate awardUpdate) {
        FirefighterFireTask firefighterTournament = new FirefighterFireTask();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setLevles(award.getLevles());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setFireName(award.getName());
            if (firefighterFireTaskService.updateFirefighterFireTask(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }

    /**
     * 培训经历批量修改
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update4")
    public AjaxResult update4(@RequestBody AwardUpdate awardUpdate) {
        FirefighterTrain firefighterTournament = new FirefighterTrain();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setLevles(award.getLevles());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setTrain(award.getName());
            if (firefighterTrainService.updateFirefighterTrain(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }

    /**
     * 应急救援任务批量修改
     * *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update5")
    public AjaxResult update5(@RequestBody AwardUpdate awardUpdate) {
        FirefighterEmergency firefighterTournament = new FirefighterEmergency();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setLevles(award.getLevles());
            firefighterTournament.setMissionTime(award.getTime());
            firefighterTournament.setEmergency(award.getName());
            if (firefighterEmergencyService.updateFirefighterEmergency(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }

    /**
     * 安保任務批量修改
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update6")
    public AjaxResult update6(@RequestBody AwardUpdate awardUpdate) {
        FirefighterSecurity firefighterTournament = new FirefighterSecurity();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setLevles(award.getLevles());
            firefighterTournament.setMissionTime(award.getTime());
            firefighterTournament.setSecurity(award.getName());
            if (firefighterSecurityService.updateFirefighterSecurity(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }
    /**
     * 个人履历批量修改
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update7")
    public AjaxResult update7(@RequestBody AwardUpdate awardUpdate) {
        FirefighterRecord firefighterTournament = new FirefighterRecord();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setEndDate(award.getEndDate());
            firefighterTournament.setStartDate(award.getStartDate());
            firefighterTournament.setUnit(award.getUnit());
            firefighterTournament.setPosition(award.getPosition());
            if (firefighterRecordService.updateFirefighterRecord(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }
    /**
     * 专业资质
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update8")
    public AjaxResult update8(@RequestBody AwardUpdate awardUpdate) {
        FirefighterQualification firefighterTournament = new FirefighterQualification();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setQualification(award.getName());
            firefighterTournament.setQualificationImage(award.getTime());
            if (firefighterQualificationService.updateFirefighterQualification(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }
    /**
     * 毕业院校批量修改
     *
     * @param
     * @2024-11-15
     */
    @PutMapping("/update9")
    public AjaxResult update9(@RequestBody AwardUpdate awardUpdate) {
        GraduationSchool firefighterTournament = new GraduationSchool();
        firefighterTournament.setFirefighterName(awardUpdate.getFirefighterName());
        firefighterTournament.setFirefighterIdCard(awardUpdate.getFirefighterIdCard());
        firefighterTournament.setId(awardUpdate.getId());
        List<AwardUpdate1> firefighterAwards = awardUpdate.getFirefighterAwards();
        boolean allSuccess = true;
        for (AwardUpdate1 award : firefighterAwards) {
            firefighterTournament.setGraduationSchoolName(award.getGraduationSchoolName());
            firefighterTournament.setMajor(award.getMajor());
            firefighterTournament.setEnrollmentDate(award.getEnrollmentDate());
            firefighterTournament.setGraduationDate(award.getGraduationDate());
            if (graduationSchoolService.updateGraduationSchool(firefighterTournament) == 0) {
                allSuccess = false;
                break;
            }
        }
        if (allSuccess) {
            return success("修改成功");
        } else {
            return success("修改失败");
        }
    }


    /**
     * 输入证件号带出名字
     */
    @PostMapping("/firefighterIdCard")
    public AjaxResult firefighterIdCard(@RequestBody FirefighterInfo firefighterIdCard) {
        FirefighterInfo firefighterInfo = new FirefighterInfo();
        firefighterInfo.setIdCardNumber(firefighterIdCard.getIdCardNumber());
        FirefighterInfo  a = firefighterInfoService.selectFirefighterInfoBySfz(firefighterInfo);
        return success(a);
    }
    /**
     * 查询部职别列表
     */
    @GetMapping("/list")
    public AjaxResult list(IfmDepartmentTitle ifmDepartmentTitle) {
        startPage();
        List<IfmDepartmentTitle> list = ifmDepartmentTitleService.selectIfmDepartmentTitleList(ifmDepartmentTitle);
        return success(list);
    }
    /**
     * 奖励情况批量添加
     *
     * @param
     * @2024-11-15
     */
    @PostMapping("/award")
    public AjaxResult award(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        final List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterAward newAward = new FirefighterAward();
            newAward.setFirefighterIdCard(firefighterIdCard);
            newAward.setFirefighterName(firefighterName);
            newAward.setAwrad(award.getName());
            newAward.setTime(award.getTime());
            newAward.setLevles(award.getLevles());
            if (firefighterAwardService.insertFirefighterAward(newAward) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }

    /**
     * 比武竞赛批量添加
     *
     * @param
     * @2024-11-15
     */
    @PostMapping("/martial")
    public AjaxResult martial(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterTournament firefighterTournament = new FirefighterTournament();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setTournament(award.getName());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setLevles(award.getLevles());
            firefighterTournament.setRank(award.getRank());
            firefighterTournament.setSubject(award.getSubject());
            if (firefighterTournamentService.insertFirefighterTournament(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }

    /**
     * 重大演习演练批量添加
     *
     * @param
     * @2024-11-15
     */
    @PostMapping("/drill")
    public AjaxResult drill(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterDrill firefighterTournament = new FirefighterDrill();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setDrill(award.getName());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setLevles(award.getLevles());
            if (firefighterDrillService.insertFirefighterDrill(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }

    /**
     * 重大火灾任务批量添加
     *
     * @param
     * @2024-11-15
     */
    @PostMapping("/task")
    public AjaxResult task(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterFireTask firefighterTournament = new FirefighterFireTask();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setFireName(award.getName());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setLevles(award.getLevles());
            if (firefighterFireTaskService.insertFirefighterFireTask(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }

    /**
     * 培训经历批量添加
     *
     * @param
     * @2024-11-15
     */
    @PostMapping("/train")
    public AjaxResult train(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterTrain firefighterTournament = new FirefighterTrain();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setTrain(award.getName());
            firefighterTournament.setTime(award.getTime());
            firefighterTournament.setLevles(award.getLevles());
            if (firefighterTrainService.insertFirefighterTrain(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }

    /**
     * 应急救援任务批量添加
     *
     * @paramR
     * @2024-11-15
     */
    @PostMapping("/emergency")
    public AjaxResult emergency(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterEmergency firefighterTournament = new FirefighterEmergency();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setEmergency(award.getName());
            firefighterTournament.setMissionTime(award.getTime());
            firefighterTournament.setLevles(award.getLevles());
            if (firefighterEmergencyService.insertFirefighterEmergency(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }

    /**
     * 安保任務批量添加
     *
     * @paramR
     * @2024-11-15
     */
    @PostMapping("/security")
    public AjaxResult security(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterSecurity firefighterTournament = new FirefighterSecurity();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setSecurity(award.getName());
            firefighterTournament.setMissionTime(award.getTime());
            firefighterTournament.setLevles(award.getLevles());
            if (firefighterSecurityService.insertFirefighterSecurity(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }

    /**
     * 个人履历批量添加
     *
     * @paramR
     * @2024-11-15
     */
    @PostMapping("/li")
    public AjaxResult li(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterRecord firefighterTournament = new FirefighterRecord();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setStartDate(award.getStartDate());
            firefighterTournament.setEndDate(award.getEndDate());
            firefighterTournament.setUnit(award.getUnit());
            firefighterTournament.setPosition(award.getPosition());
            if (firefighterRecordService.insertFirefighterRecord(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }
    /**
     * 专业资质批量新增
     *
     * @paramR
     * @2024-11-15
     */
    @PostMapping("/qualification")
    public AjaxResult qualification(@RequestBody FirefighterAwardVo firefighterAwardVo) {
        String firefighterName = firefighterAwardVo.getFirefighterName();
        String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
        List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
        boolean allSuccess = true;
        for (AddVo award : firefighterAwards) {
            FirefighterQualification firefighterTournament = new FirefighterQualification();
            firefighterTournament.setFirefighterIdCard(firefighterIdCard);
            firefighterTournament.setFirefighterName(firefighterName);
            firefighterTournament.setQualification(award.getName());
            firefighterTournament.setQualificationImage(award.getTime());
            if (firefighterQualificationService.insertFirefighterQualification(firefighterTournament) == 0) {
                allSuccess = false;
                break; // 如果只要一次失败就返回，则使用 break
            }
        }
        if (allSuccess) {
            return success("添加成功");
        } else {
            return success("添加失败");
        }
    }
    /**
     * 毕业院校批量新增
     *
     *
     * @2024-11-28
     */
@PostMapping("/graduation")
public AjaxResult graduation(@RequestBody FirefighterAwardVo firefighterAwardVo) {
    String firefighterName = firefighterAwardVo.getFirefighterName();
    String firefighterIdCard = firefighterAwardVo.getFirefighterIdCard();
    List<AddVo> firefighterAwards = firefighterAwardVo.getFirefighterAwards();
    boolean allSuccess = true;
    for (AddVo award : firefighterAwards) {
        GraduationSchool firefighterTournament = new GraduationSchool();
        firefighterTournament.setFirefighterIdCard(firefighterIdCard);
        firefighterTournament.setFirefighterName(firefighterName);
        firefighterTournament.setGraduationSchoolName(award.getGraduationSchoolName());
        firefighterTournament.setMajor(award.getMajor());
        firefighterTournament.setEnrollmentDate(award.getEnrollmentDate());
        firefighterTournament.setGraduationDate(award.getGraduationDate());
        if (     graduationSchoolService.insertGraduationSchool(firefighterTournament) == 0) {
            allSuccess = false;
            break; // 如果只要一次失败就返回，则使用 break
        }
    }
    if (allSuccess) {
        return success("添加成功");
    } else {
        return success("添加失败");
    }
}
}

